package com.jeff.android.lab.jetpack;

import com.jeff.android.lab.BaseRecyclerViewFragment;
import com.jeff.android.lab.jetpack.activity.Activity_1_2;
import com.jeff.android.lab.jetpack.datastore.DataStoreFragment;
import com.jeff.android.lab.jetpack.fragment.Fragment_1_3;
import com.jeff.android.lab.jetpack.viewpager2.ViewPager2Fragment;
import com.jeff.android.lab.jetpack.viewpager2.ViewPager2TransformFragment;
import com.jeff.android.lab.util.RouterUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: dingfeng
 * @date: 2020-10-29
 * @since: 1.0.0
 **/
public class JetPackMainFragment extends BaseRecyclerViewFragment {

    @Override
    protected List<String> getData() {
        return new ArrayList<String>() {
            {
                add("Activity");
                add("Fragment");
                add("DataStore");
                add("ViewPager2");
                add("ViewPager2-transform");
            }
        };
    }

    @Override
    protected void launch(String widget) {
        if ("Activity".equals(widget)) {
            RouterUtil.launchActivity(mContext, Activity_1_2.class);
        } else if ("Fragment".equals(widget)) {
            RouterUtil.launchFragmentActivity(getContext(), Fragment_1_3.class);
        } else if ("DataStore".equals(widget)) {
            RouterUtil.launchFragmentActivity(getContext(), DataStoreFragment.class);
        } else if ("ViewPager2".equals(widget)) {
            RouterUtil.launchFragmentActivity(getContext(), ViewPager2Fragment.class);
        } else if ("ViewPager2-transform".equals(widget)) {
            RouterUtil.launchFragmentActivity(getContext(), ViewPager2TransformFragment.class);
        }
    }

}
